package com.gd.coreservice.mapper;

import com.gd.coreservice.entity.Orders;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gd.coreservice.entity.vo.OrdersVo;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author testjava
 * @since 2024-03-23
 */
public interface OrdersMapper extends BaseMapper<Orders> {
@Select("SELECT orders.*,goods.item_name,goods.seller_username,goods.photo_url,goods.description,users.username FROM users,orders LEFT JOIN goods ON orders.gid = goods.gid WHERE (IFNULL(Oid,'') LIKE concat('%', #{oid}, '%')) AND orders.seller_id=users.uid AND `orders`.seller_id=#{sellerUid}")
    List<OrdersVo> findOneBuy(String sellerUid, String oid);
@Select("SELECT SUM(price) FROM orders")
    String getPriceTotal();
}
